 // 创建一个自定义的提示框
        var successMessage = document.createElement('div');
    successMessage.id = "successMessage";
        successMessage.style.position = 'fixed';
        successMessage.style.top = '60px';
        successMessage.style.left = '45%';
        successMessage.style.padding = '10px';
        successMessage.style.backgroundColor = 'rgb(125, 206, 125)';
        successMessage.style.color = 'white';
        successMessage.style.borderRadius = '5px';
        successMessage.style.zIndex = '99999';
        successMessage.style.display = 'none'; // 初始时不显示
        successMessage.innerText = '复制成功！';
        document.body.appendChild(successMessage);

    const myMap = new Map();
    // 设置键值对
    myMap.set('沁悦大酒店(常州湖塘纺织城店)', '${userName}  ${roomType} ${mealType}  ${startDate}  ${roomNum}${nightNum}  00000');
    myMap.set('常州环球港邮轮酒店', '${userName}  ${roomType}-${mealType} ${startDate}  ${roomNum}${nightNum}  晨风旅行社 房价00000   房费预付，杂费自理，房价保密');
    myMap.set("常州富都戴斯酒店", '店名 : 常州富都戴斯酒店</br>入离日期 :${startDate}至${endDate}共${nightNum}</br>客人姓名：${userName}</br>预订房型: ${roomType}房 ${mealType} ${roomNum}</br>结算价：00000</br>来源：艺龙</br>备注：该客人房费已支付，本公司统一结算。房价保密，杂费自理。</br>发票：本公司开具。</br>烦请确认回复，谢谢');
     myMap.set('常州远洲酒店', '${userName}  ${roomType} ${mealType}  ${startDate}  ${roomNum}${nightNum}  00000');
    //myMap.set('茗静园·安吉禧玥山居度假酒店', '${userName}  ${roomType} ${mealType}  ${startDate}  ${roomNum}${nightNum}  00000');
    //  myMap.set('建湖九龙国际大酒店', '${userName}  ${roomType} ${mealType}  ${startDate}  ${roomNum}${nightNum}  00000');
     myMap.set("南京国际会议大酒店", '客人：${userName}</br>入住：${startDate}</br>离店：${endDate}</br>房型：${roomType}</br>早餐：${mealType}</br>间数： ${roomNum}</br>金额：00000</br>渠道：${channel}');
     myMap.set("无锡鲁能万豪酒店",  '${userName}  ${roomType} ${mealType}  ${startDate}  ${roomNum}${nightNum}  ');
    //  myMap.set("常州都喜天丽富都龙城酒店", '${userName}  ${roomType} <${mealType}>  ${startDate}  ${roomNum}${nightNum}  ${channel} 00000  富都龙城');
    // myMap.set("瑞颐康养酒店", '酒店名 : 苏州瑞颐康养酒店</br>入离日期 : ${startDate}~${endDate}  共${nightNum}</br>客人姓名 :  ${userName}</br>预订房型 : ${roomType}-${roomNum} ${mealType}               </br>结算价：00000');
    myMap.set("茅山道温泉度假村", '预订信息</br>预订日期:${startDate}</br>预订业务员:美团合作</br>预订人:${userName}</br>预订房型:${roomType}</br>房间数量:${roomNum}${nightNum}</br>房费:00000/间</br>备注:');
    myMap.set('建德航空小镇君澜度假酒店', '酒店名 : 建德航空小镇君澜度假酒店</br>入离日期 : ${startDate}至 ${endDate}共${nightNum}</br>客人姓名 :${userName}  </br>预订房型 : ${roomType}+${mealType}  ${roomNum}</br>结算：200');
    myMap.set('常州宝丽格大酒店', '${userName}  ${roomType} ${mealType}  ${startDate}  ${roomNum}${nightNum}  000000');
    myMap.set('苏州高新华美达酒店', '${userName}  ${roomType} ${mealType}  ${startDate}  ${roomNum}${nightNum}  苏州高新华美达酒店');
    myMap.set('壹宿酒店(伍家岗万达广场店)', '${userName}  ${roomType} ${mealType}  ${startDate}  ${roomNum}${nightNum}  壹宿酒店(伍家岗万达广场店)');
    myMap.set("常州万泽酒店(武进春秋淹城店)", '${userName}   ${roomType}-${mealType} ${startDate}  ${roomNum}${nightNum}  000000');
    myMap.set('溧阳水西·酒店', '${userName}  ${roomType} ${mealType}  ${startDate}  ${roomNum}${nightNum} 000 ')
    myMap.set('南宁荣荣大酒店(江南万达店)', '${userName}  ${roomType} ${mealType}  ${startDate}  ${roomNum}${nightNum}  南宁荣荣大酒店(江南万达店)')
    myMap.set('艺龙瑞云酒店(河源火车站万隆城店)', '${userName}  ${roomType} ${mealType}  ${startDate}  ${roomNum}${nightNum}  000')
    myMap.set('龙岩万阳城商务大酒店', '${userName}  ${roomType} ${mealType}  ${startDate}  ${roomNum}${nightNum}  售卖价 000')
    myMap.set('龙岩星辰智能投影酒店(万宝广场店)', '${userName}  ${roomType} ${mealType}  ${startDate}  ${roomNum}${nightNum}  售卖价 000')
    myMap.set('维纳斯国际酒店(青阳城区店)', '${userName}  ${roomType} ${mealType}  ${startDate}  ${roomNum}${nightNum}')
    myMap.set('德鸿汇金酒店', '${userName}  ${roomType}-${mealType}  ${startDate}  ${roomNum}${nightNum} 售卖价:000')
    myMap.set('维也纳酒店(常州金坛凤凰城店)', '${userName}  ${roomType}-${mealType}  ${startDate}  ${roomNum}${nightNum} 艺龙 000')
    myMap.set('君渡凉城假日酒店', '${roomType} ${mealType} ${roomNum}店</br> 住 ${startDate}  离 ${endDate}   ${nightNum}店</br> ${userName}   价格000/间夜')


    $(document).ready(function(){

        let intervalID = setInterval(function() {
            addRemark()
        }, 100);
    })

    function extractBreakfast(str) {
        // 匹配含双早、含单早或不含早
        let match = str.match(/含(双|单)?早/);

        if (match) {
            // 如果有匹配的内容，返回相应的结果
            if (match[0] === '含双早') {
                return '含双早';
            } else if (match[0] === '含单早') {
                return '含单早';
            } else {
                return '不含早';
            }
        } else {
            return '不含早';  // 如果没有匹配到任何“含早”的描述，则返回“不含早”
        }
    }
    function addRemark(){
        const rows = $(".el-table__row")
        rows.each(function(index,row){
            const selfTdList = $(row).find('.self-td');
            if(selfTdList.length>0){
                return
            }
            console.log(1111)
            const firstTd = $(row).find('td:first')
            const hotelName =  firstTd.find(".order-wrapper").find("div").eq(1).text()
            const thirdTd = $(row).find('td').eq(1)
            const roomTypeStr =thirdTd.text()
            const roomType = getRoomType(roomTypeStr.split(" ")[1])
            const mealType = extractBreakfast(roomTypeStr)
            // console.log("roomType",roomType)
            // console.log("mealType",mealType)
            const roomNum = $(thirdTd.find(".text-active")[0]).text().trim()
            const fourthTd = $(row).find('td').eq(2)
            const pList = fourthTd.find("p")
            const startDate = $(pList[0]).text().split(" ")[1]
            const endDate = $(pList[1]).text().split(" ")[1]
            const nightNum = $(pList[2]).text()

            const fifthTd = $(row).find('td').eq(3)
            const spanArr = fifthTd.find('.cursor-pointer')
            let userName = $(spanArr[0]).text()
            //console.log("userName",userName)
            if(userName.indexOf('成人')>-1){
                userName= $(spanArr[1]).text()
            }
            myMap.forEach((value, key) => {
                if(key == hotelName){
                    const template = myMap.get(key)
                    //console.log(template)
                    // 用正则表达式替换模板字符串中的变量
                    var result = template.replace("${name}", hotelName)
                    .replace("${userName}", userName)
                    .replace("${roomType}", roomType)
                    .replace("${mealType}", mealType)
                    .replace("${startDate}", startDate)
                    .replace("${endDate}", endDate)
                    .replace("${roomNum}", roomNum)
                    .replace("${nightNum}", nightNum)
                    // .replace("${channel}", channel);
                    $(row).append('<td class="self-td" style="position:absolute;height:100px;overflow:auto;display:none">'+result+'</td>');

                    // 获取当前行的相对于页面的位置
                    var offset = $(row).offset();
                    var trHeight = $(row).height();

                    // 创建并设置浮动的 div
                    var floatingBtn = $('<div class="floating-div">'+"点击复制"+'</div>');
                    floatingBtn.css({
                        backgroundColor:'wheat',
                        position: 'absolute',
                        right:"150px",
                        width: '65px', // 设置浮动 div 的宽度与当前行一致
                        height:'18px',
                        //backgroundColor: '#ffcc00', // 设置背景色
                        padding: '10px',
                        marginTop: '40px',
                        textAlign: 'center',
                        zIndex: 9999, // 设置浮动 div 的层级
                        borderRadius: '5px'
                    });
                    floatingBtn.on('click',function(){
                        navigator.clipboard.writeText(result.replace(/<\/br>/g, '\n'));
                         // 显示复制成功的提示
                    successMessage.style.display = 'block';

                    // 2秒后隐藏提示
                    setTimeout(function() {
                        successMessage.style.display = 'none';
                    }, 1000);
                    })
                    // 将浮动 div 添加到页面中
                    $(row).append(floatingBtn);
                }
            });
        })
    }

 function getRoomType(inputString) {
        if(!inputString){
            return ""
        }
     // console.log('roomType',inputString)
     const roomRegex = /(.+?[房|间|屋][ABCDE]?)/; // 匹配房型（如“豪华双人房”或“豪华大床间”）
     const roomMatch = inputString.match(roomRegex);  // 匹配房型
     if(roomMatch) {
         return roomMatch[1];
     }
     return inputString.split('<')[0];  // 如果匹配到，返回房型；否则返回空字符串
 }
